<template>
    <div class="user">

        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>超管</el-breadcrumb-item>
            <el-breadcrumb-item>用户管理</el-breadcrumb-item>
        </el-breadcrumb>

        <el-card>
            <el-table :data="list" border stripe>
                <el-table-column type="expand" label="#">
                    <template slot-scope="scope">
                        <el-row v-for="(item1,idx1) of scope.row" :key="item1">
                            <el-col :span="6">
                                <el-tag closable>
                                    {{item1._id}}
                                </el-tag>
                            </el-col>
                            <el-col :span="18"></el-col>
                        </el-row>
                    </template>
                </el-table-column>
                <el-table-column prop="_id" label="id" width="300"> </el-table-column>
                <el-table-column prop="name" label="用户名" width="300"> </el-table-column>
                <el-table-column prop="authType" label="权限类型" width="200"> </el-table-column>
                <el-table-column label="操作" width="350">
                    <template slot-scope="scope">
                        <el-button type="warning" size="small" icon="el-icon-setting">配置权限
                        </el-button>
                        <el-button type="danger" size="small" icon="el-icon-delete">删除
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-card>
    </div>
</template>

<script>
export default {
    data() {
        return {
            list: []
        }
    },
    methods: {
        handleDelete(index, row) {
            console.log(index, row)
        }
    },
    beforeMount() {
        this.$http.get('/user/').then(res => {
            if (res.data.status == 1) {
                console.log(res)
                this.$message.success(res.data.msg)
                this.list = res.data.data
            } else {
                this.$message.error(res.data.msg)
                localStorage.removeItem('token')
            }
        })
    }
}
</script>

<style>
.user {
    margin-right: 20px;
}
.el-breadcrumb {
    margin-bottom: 15px;
}
</style>